<?php
class find_products extends Controller {
	
	public $viewData;
	
	function find_products() {
		parent::Controller();
		
		$this->load->library('cartpool');
		$this->load->library('session');
		
		$this->output->set_header("Cache-Control: no-store, no-cache, must-revalidate");
	}
	
	function index() {
		if(isset($this->session->userdata['id'])){
			$search = "";
			if(isset($_REQUEST['search'])){
				$search = $_REQUEST['search'];		
			}
						
			if($search != ""){
				$this->viewData->cartpoolData["wasSearch"] = TRUE;
			}
			
			
			$this->viewData->cartpoolData["products"] = $this->cartpool->findProducts($search);
			$this->viewData->productList_data = $this->load->view('products_data', $this->viewData); 
		}
	}
}